package com.skit.ecm.activity

import android.os.Bundle
import android.view.View
import com.alibaba.android.arouter.facade.annotation.Route
import com.skit.common.base.BaseActivity
import com.skit.common.config.RouteConfig
import com.skit.common.manager.UserManager
import com.skit.ecm.R
import kotlinx.android.synthetic.main.activity_setting.*

/**
 * @author shuike <a href="mailto:shuike007@gmail.com">Contact me.</a>
 * @version 1.0
 * @since  2020/5/20
 */

@Route(path = RouteConfig.AppRoute.SETTING_ACTIVITY)
class SettingActivity : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_setting)
        setSupportActionBar(toolbar)
        supportActionBar?.setDisplayHomeAsUpEnabled(true)
        user()
        logout.setOnClickListener {
            UserManager.logout()
            user()
        }
    }

    private fun user() {
        logout.visibility = if (UserManager.user != null) View.VISIBLE else View.GONE
    }
}